/**
 * @brief SDIO/SD-Card 驱动
 * @author 张勇 / 2020-05-13
 */

#pragma once

#include <stm32f4xx.h>
#include "_mcu_gpio.h"
#include "mcu.h"
#include "unidrv/ffsystem.h"

#ifdef __cplusplus
extern "C" {
#endif

/// @brief SDIO/SD-Card 驱动数据结构
typedef struct _mcu_sdio {
    SD_HandleTypeDef sdc;
    HAL_SD_CardInfoTypeDef card;
} mcu_sdio_t;

//
// 标准 FatFS-Disk-IO APIs
//
DSTATUS ffdisk_sdio_init  (ffdisk_t *disk);
DSTATUS ffdisk_sdio_status(ffdisk_t *disk);
DRESULT ffdisk_sdio_read  (ffdisk_t *disk, BYTE *buff, LBA_t sector, UINT count);
DRESULT ffdisk_sdio_write (ffdisk_t *disk, const BYTE *buff, LBA_t sector, UINT count);
DRESULT ffdisk_sdio_ioctl (ffdisk_t *disk, BYTE cmd, void *buff);


#ifdef __cplusplus
}
#endif
